package com.example.bootdemo.controller;

import com.example.bootdemo.entity.TUser;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/them")
public class ThemController {


    @RequestMapping("/themTest1")
    public String themTest1(Model model){
        model.addAttribute("message", "我的message是放在model 中的");

        TUser TUser1 = new TUser("yejing",22,"一个幽默且热爱java的社会青年");
        List<String> userList=new ArrayList<>();
        userList.add("zhang san 66");
        userList.add("li si 66");
        userList.add("wang wu 66");
        userList.add("wang wu 66");
        userList.add("wang wu 66");
        userList.add("wang wu 66");
        userList.add("wang wu 66");
        userList.add("wang wu 66");
        userList.add("wang wu 66");
        userList.add("wang wu 66");
        userList.add("wang wu 66");
        userList.add("wang wu 66");
        Map<String ,String> map=new HashMap<>();
        map.put("place","博学谷");
        map.put("feeling","very well");
        //数据添加到model中
        model.addAttribute("name","bigsai");//普通字符串
        model.addAttribute("user", TUser1);//储存javabean
        model.addAttribute("userlist",userList);//储存List
        model.addAttribute("map",map);//储存Map
        return "themTest1";
    }
}
